import { reject } from "async";

export const getsettings=()=>{
  return new Promise((resolve,reject)=>{
    wx.getSetting({
      success: (result) => {
        resolve(result);
      },
      fail:(err)=>{
        reject(err);
      }
  })
  })
}

export const chooseAddresss=()=>{
  return new Promise((resolve,reject)=>{
    wx.chooseAddress({
      success: (result) => {
        resolve(result);
      },
      fail:(err)=>{
        reject(err);
      }
  })
  })
}

export const openSettings=()=>{
  return new Promise((resolve,reject)=>{
    wx.openSetting({
      success: (result) => {
        resolve(result);
      },
      fail:(err)=>{
        reject(err);
      }
  })
  })
}
/**
 * 弹窗
 */
export const showModal=({content})=>{
  return new Promise((resolve)=>{
    wx.showModal({
      title: '提示',
      content: content,
      success: (res)=> {
          resolve(res) 
      }
    })
 })
}  

export const showToast=({title})=>{
  return new Promise((resolve,reject)=>{
    wx.showToast({
      title: title,
      icon: 'success',
      success: (result) => {
        resolve(result);
      },
      fail:(err)=>{
        reject(err);
      }
    })
 })
}  